$(function(){
	var favStr = localStorage.getItem("favBookInfo") || "[]";
	var favJson = JSON.parse(favStr);
	if(favJson.length <= 0){
		$("#tabs").append($('<div class="ui-widget">'+
										'<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">'+
											'<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>'+
											'<strong>Hey!</strong> &#65292;&#20070;&#26550;&#37324;&#20160;&#20040;&#20063;&#27809;&#26377;&#65292;&#24555;&#21435;&#21152;&#20837;&#21916;&#27426;&#30340;&#20070;&#21543;&#65281;</p>'+
										'</div>'+
									'</div>'));
		return true;
	}
	for(var i=0;i<favJson.length;i++){
		var ele = favJson[i];
		$("#nav").append($('<li><a href="#tabs-'+i+'">'+ele+'</a><a id="del'+i+'" index="'+i+'"  title="&#19979;&#26550;['+ele+']" style="cursor:pointer;color:red;">&#21024;</a></li>'));
		$("#del"+i).click(function(){
			favJson.splice($(this).attr('index'),1);
			localStorage.setItem("favBookInfo",JSON.stringify(favJson));
			location.reload();
		});
		$("#tabs").append($('<div id="tabs-'+i+'"><iframe width="100%" frameborder="0" height="800" src="search.html?url=%2Fsearch.php%3Fw%3D'+encodeURIComponent(ele)+'"></iframe></div>'));
	};
	$( "#tabs" ).tabs();
})